package com.dshore.messagecenter.controller.warning;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dshore.messagecenter.log.LogAnnotation;
import com.dshore.messagecenter.model.system.ResponseResult;
import com.dshore.messagecenter.model.system.SysDict;
import com.dshore.messagecenter.service.warning.WarningIndicatorsService;
import com.dshore.messagecenter.util.Page;


/**
 * 预警指标
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/warningIndicators")
public class WarningIndicatorsController {
	
	@Autowired
	private WarningIndicatorsService warningIndicatorsService;
	/**
	 * 页面
	 * @return
	 */
	@RequestMapping("/toWarningIndicators")
	public String show() {
		return "warning/sysWarningIndicators";
		
	}
	/**
	 * 获取页面表格数据
	 * @param sysDict
	 * @return
	 */
	@RequestMapping("/getWarningIndicators")
	@ResponseBody
	public Page<SysDict> getWarningIndicators(@RequestBody SysDict sysDict){
		return warningIndicatorsService.getWarningIndicators(sysDict);
		
	}
	/**
	 * 展示单条数据
	 * @param id
	 * @return
	 */
	@RequestMapping("/getById")
	@ResponseBody
	public SysDict getById(String id) {
		return warningIndicatorsService.getById(id);
	
	}
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	@LogAnnotation(methodType="删除",targetType="预警指标",argsName="ids",tableName="T_SYS_DICT",fieldName="DICT_NAME")
	public ResponseResult<Void> deleteByIds(String ids){
		return warningIndicatorsService.deleteByIds(ids);
	}
	/**
	 * 新增
	 * @param sysDict
	 * @return
	 */
	@RequestMapping("/addIndicators")
	@ResponseBody
	@LogAnnotation(methodType="新增",targetType="预警指标",argsName="dictName")
	public ResponseResult<Void> addIndicators(SysDict sysDict){
		return warningIndicatorsService.addIndicators(sysDict);
		
	}
	/**
	 * 修改
	 * @param sysDict
	 * @return
	 */
	@RequestMapping("/changeIndicators")
	@ResponseBody
	@LogAnnotation(methodType="修改",targetType="预警指标",argsName="dictName")
	public ResponseResult<Void> changeIndicators(SysDict sysDict){
		return warningIndicatorsService.changeIndicators(sysDict);
		
	}
	
	/**
	 * 校验
	 * @param id
	 * @param dictName
	 * @return
	 */
	@RequestMapping("/checkIndicators")
	@ResponseBody
	public String checkIndicators(String id,String indicators1){
		return warningIndicatorsService.checkIndicators(id,indicators1);
		
	}
	
}
